Skip to content

Commit f8ad249

Browse files
committed
fixed binding generator to work with jarPats, instead of jarDir
1 parent 241ae1c commit f8ad249

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

build/project-template-gradle/build-tools/android-static-binding-generator/binding-generator/src/main/java/com/extend/generator/ExtendClassGenerator.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@ public static void main(String[] args) throws Exception {
2323
if (args != null )
2424
{
2525
if(args.length > 0) {
26-
27-
jarsDir = args[0];
26+
bindingsPath = args[0];
2827
}
2928
if(args.length > 1) {
30-
31-
bindingsPath = args[1];
32-
}
33-
if(args.length > 2) {
34-
35-
outName = args[2];
29+
outName = args[1];
3630
}
31+
32+
//rest of the arguments are jar paths
3733
}
3834

3935
new File(outName).mkdir(); //make shure there is an out folder
40-
41-
jarFilesDir = new File(jarsDir).getCanonicalPath();
36+
4237
String pathToBindingsFile = new File(bindingsPath).getCanonicalPath();
4338
outFilesDir = new File(outName).getCanonicalPath();
4439

@@ -82,12 +77,12 @@ private static HashMap<String, HashSet<String>> ReadProxyNames(String bindingsPa
8277
}
8378
}
8479

85-
for(String key : result.keySet()) {
86-
System.out.println(key);
87-
for(String mn : result.get(key)){
88-
System.out.println(" " + mn);
89-
}
90-
}
80+
// for(String key : result.keySet()) {
81+
// System.out.println(key);
82+
// for(String mn : result.get(key)){
83+
// System.out.println("\t" + mn);
84+
// }
85+
// }
9186

9287
//Close the input stream
9388
br.close();

build/project-template-gradle/build-tools/android-static-binding-generator/binding-generator/src/main/java/com/extend/generator/JarLister.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ public static void startGenerateBindings(String[] args, HashMap<String, HashSet<
937937
overridenClasses = proxyNames;
938938

939939
loader = NSClassLoader.getInstance();
940-
loader.loadDir(ExtendClassGenerator.jarFilesDir);
940+
loader.loadJars(args);
941941

942942
String[] jars = loader.getJarNames();
943943

@@ -967,7 +967,7 @@ private static void start(String[] args, String[] jars, String[] outDirs) throws
967967

968968
JarInputStream input = null;
969969

970-
String jarFilename = new File(ExtendClassGenerator.jarFilesDir, jarFile).getCanonicalPath();
970+
String jarFilename = new File(jarFile).getCanonicalPath();
971971
try {
972972
input = new JarInputStream(new FileInputStream(jarFilename));
973973
}
@@ -997,9 +997,8 @@ private static void start(String[] args, String[] jars, String[] outDirs) throws
997997
//
998998

999999
for (String className : classes) {
1000-
10011000
//
1002-
if (jarFile.equals("nativescript.jar") && className.startsWith("com.tns.com.tns.tests.")) {
1001+
if (jarFile.endsWith("nativescript.jar") && className.startsWith("com.tns.com.tns.tests.")) {
10031002
continue;
10041003
}
10051004
//

build/project-template-gradle/build-tools/android-static-binding-generator/binding-generator/src/main/java/com/extend/generator/NSClassLoader.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public String[] getJarNames() {
3838
for(int i = 0; i < this.jarFiles.size(); i++) {
3939

4040
String jarName = this.jarFiles.get(i);
41-
String currentName = jarName.substring(jarName.lastIndexOf('\\') + 1);
42-
jarNames[i] = currentName;
41+
// String currentName = jarName.substring(jarName.lastIndexOf('\\') + 1);
42+
jarNames[i] = jarName;
4343
}
4444

4545
return jarNames;
@@ -52,6 +52,13 @@ public void loadDir(String path)
5252
this.populateClassNames();
5353
}
5454

55+
public void loadJars(String[] args) {
56+
for(int i = 2; i < args.length; i ++) {
57+
String currentJar = args[i];
58+
onFile(new File(currentJar));
59+
}
60+
}
61+
5562
private void populateClassNames()
5663
{
5764
JarInputStream input = null;

0 commit comments

Comments
 (0)