Skip to content

Commit

Permalink
Merge branch 'master' into applicationLocal
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullahFaqeir authored Sep 20, 2024
2 parents 096fa9f + e1212e9 commit 0fe8f1a
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 10 deletions.
10 changes: 6 additions & 4 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2174,10 +2174,12 @@ AndroidBuilder.prototype.generateRootProjectFiles = async function generateRootP
// Create a "local.properties" file providing a path to the Android SDK directory.
await gradlew.writeLocalPropertiesFile(this.androidInfo.sdk.path);

// Copy our root "build.gradle" template script to the root build directory.
await fs.copyFile(
path.join(this.templatesDir, 'root.build.gradle'),
path.join(this.buildDir, 'build.gradle'));
// Generate root "build.gradle" template script to the root build directory.
let buildGradleContent = await fs.readFile(path.join(this.templatesDir, 'root.build.gradle'));
buildGradleContent = ejs.render(buildGradleContent.toString(), {
classpaths: [],
});
await fs.writeFile(path.join(this.buildDir, 'build.gradle'), buildGradleContent);

// Copy our Titanium template's gradle constants file.
// This provides the Google library versions we use and defines our custom "AndroidManifest.xml" placeholders.
Expand Down
11 changes: 7 additions & 4 deletions android/cli/commands/_buildModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,13 @@ AndroidModuleBuilder.prototype.generateRootProjectFiles = async function generat
// Create a "local.properties" file providing a path to the Android SDK directory.
await gradlew.writeLocalPropertiesFile(this.androidInfo.sdk.path);

// Copy our root "build.gradle" template script to the root build directory.
// Generate root "build.gradle" template script to the root build directory.
const templatesDir = path.join(this.platformPath, 'templates', 'build');
await fs.copyFile(
path.join(templatesDir, 'root.build.gradle'),
path.join(this.buildDir, 'build.gradle'));
let buildGradleContent = await fs.readFile(path.join(templatesDir, 'root.build.gradle'));
buildGradleContent = ejs.render(buildGradleContent.toString(), {
classpaths: (this.manifest.classpaths?.split(',') ?? []).filter(classpath => classpath !== ''),
});
await fs.writeFile(path.join(this.buildDir, 'build.gradle'), buildGradleContent);

// Copy our Titanium template's gradle constants file.
// This provides the Google library versions we use and defines our custom "AndroidManifest.xml" placeholders.
Expand Down Expand Up @@ -562,6 +564,7 @@ AndroidModuleBuilder.prototype.generateModuleProject = async function generateMo
let buildGradleContent = await fs.readFile(path.join(this.moduleTemplateDir, 'build.gradle'));
buildGradleContent = ejs.render(buildGradleContent.toString(), {
compileSdkVersion: this.compileSdkVersion,
plugins: (this.manifest.plugins?.split(',') ?? []).filter(plugin => plugin !== ''),
krollAptJarPath: path.join(this.platformPath, 'kroll-apt.jar'),
minSdkVersion: this.minSupportedApiLevel,
moduleAuthor: this.manifest.author,
Expand Down
10 changes: 10 additions & 0 deletions android/templates/build/root.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@ buildscript {
classpath 'com.android.tools.build:gradle:8.3.1'
classpath 'com.google.gms:google-services:4.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
<% for (let i = 0; i < classpaths.length; i++) {%>
classpath '<%= classpaths[i] %>'
<% } %>
}
}

// Load the module developer's optional "root.build.gradle" file from "<module>/android" directory.
// This gradle file is expected to provide the module's "dependencies".
def moduleRootBuildGradlePath = "${projectDir}/../root.build.gradle"
if (file(moduleRootBuildGradlePath).exists()) {
apply from: moduleRootBuildGradlePath
}

allprojects {
repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,13 @@ name: <%- moduleName %>
moduleid: <%- moduleId %>
guid: <%- guid %>
platform: <%- platform %>
#
# Classpaths and plugins are used for android packages that requires them
# to use them you have to add your classpaths and plugins comma separated
# Ex:
# classpaths: classpath1,classpath2
# plugins: plugin1,plugin2
#
classpaths:
plugins:
minsdk: <%- tisdkVersion %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

dependencies {
// Add the module's library root project dependencies here.
}
3 changes: 3 additions & 0 deletions android/templates/module/generated/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
<% for(var i=0; i<plugins.length; i++) {%>
apply plugin: '<%= plugins[i] %>'
<% } %>

repositories {
maven {
Expand Down
2 changes: 1 addition & 1 deletion build/lib/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ async function addTiAppProperties() {
} else if (line.indexOf('<use-app-thinning>') >= 0) {
content.pop();
content.push('\t\t<use-app-thinning>false</use-app-thinning>');
// Grab contents of modules/modules.xml to inject as moduel listing for tiapp.xml
// Grab contents of modules/modules.xml to inject as module listing for tiapp.xml
// This allows PR to override
} else if (line.indexOf('<modules>') >= 0) {
// remove open tag
Expand Down
2 changes: 1 addition & 1 deletion iphone/TitaniumKit/TitaniumKit/Sources/API/KrollModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* @param moduleID is assumed to be the module name (classname with the "Module" suffix stripped off) - i.e. "UI", "App", "Media"
* We will generate the full class name from the moduleID: "UI" => "UIModule", "com.appcelerator.urlSession" => "ComAppceleratorUrlSessionModule"
* @return TiModule* or ObjcProxy* based on whether the module is an older style proxy moduel or a new Obj-C JSC API style (currently only 1st party in-SDK code)
* @return TiModule* or ObjcProxy* based on whether the module is an older style proxy module or a new Obj-C JSC API style (currently only 1st party in-SDK code)
*/
+ (id<Module>)loadCoreModule:(NSString *)moduleID inContext:(JSContext *)jsContext;

Expand Down

0 comments on commit 0fe8f1a

Please sign in to comment.