Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 318f6822 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Export API files as part of the java_sdk_library"

parents b6619618 1fd005d5
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -383,6 +383,7 @@ type ApiFilePath interface {
// Provider of information about API stubs, used by java_sdk_library.
// Provider of information about API stubs, used by java_sdk_library.
type ApiStubsProvider interface {
type ApiStubsProvider interface {
	ApiFilePath
	ApiFilePath
	RemovedApiFilePath() android.Path
	StubsSrcJar() android.Path
	StubsSrcJar() android.Path
}
}


@@ -1271,6 +1272,10 @@ func (d *Droidstubs) ApiFilePath() android.Path {
	return d.apiFilePath
	return d.apiFilePath
}
}


func (d *Droidstubs) RemovedApiFilePath() android.Path {
	return d.removedApiFile
}

func (d *Droidstubs) StubsSrcJar() android.Path {
func (d *Droidstubs) StubsSrcJar() android.Path {
	return d.stubsSrcJar
	return d.stubsSrcJar
}
}
+32 −8
Original line number Original line Diff line number Diff line
@@ -238,7 +238,8 @@ type sdkLibraryProperties struct {
type scopePaths struct {
type scopePaths struct {
	stubsHeaderPath    android.Paths
	stubsHeaderPath    android.Paths
	stubsImplPath      android.Paths
	stubsImplPath      android.Paths
	apiFilePath     android.Path
	currentApiFilePath android.Path
	removedApiFilePath android.Path
	stubsSrcJar        android.Path
	stubsSrcJar        android.Path
}
}


@@ -330,7 +331,8 @@ func (module *SdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
			if scopeTag, ok := tag.(scopeDependencyTag); ok {
			if scopeTag, ok := tag.(scopeDependencyTag); ok {
				apiScope := scopeTag.apiScope
				apiScope := scopeTag.apiScope
				scopePaths := module.getScopePaths(apiScope)
				scopePaths := module.getScopePaths(apiScope)
				scopePaths.apiFilePath = doc.ApiFilePath()
				scopePaths.currentApiFilePath = doc.ApiFilePath()
				scopePaths.removedApiFilePath = doc.RemovedApiFilePath()
				scopePaths.stubsSrcJar = doc.StubsSrcJar()
				scopePaths.stubsSrcJar = doc.StubsSrcJar()
			} else {
			} else {
				ctx.ModuleErrorf("depends on module %q of unknown tag %q", otherName, tag)
				ctx.ModuleErrorf("depends on module %q of unknown tag %q", otherName, tag)
@@ -831,6 +833,12 @@ type sdkLibraryScopeProperties struct {


	// The stub sources.
	// The stub sources.
	Stub_srcs []string `android:"path"`
	Stub_srcs []string `android:"path"`

	// The current.txt
	Current_api string `android:"path"`

	// The removed.txt
	Removed_api string `android:"path"`
}
}


type sdkLibraryImportProperties struct {
type sdkLibraryImportProperties struct {
@@ -1194,6 +1202,8 @@ type sdkLibrarySdkMemberProperties struct {
type scopeProperties struct {
type scopeProperties struct {
	Jars           android.Paths
	Jars           android.Paths
	StubsSrcJar    android.Path
	StubsSrcJar    android.Path
	CurrentApiFile android.Path
	RemovedApiFile android.Path
	SdkVersion     string
	SdkVersion     string
}
}


@@ -1209,6 +1219,8 @@ func (s *sdkLibrarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMembe
			properties.Jars = jars
			properties.Jars = jars
			properties.SdkVersion = apiScope.sdkVersion
			properties.SdkVersion = apiScope.sdkVersion
			properties.StubsSrcJar = paths.stubsSrcJar
			properties.StubsSrcJar = paths.stubsSrcJar
			properties.CurrentApiFile = paths.currentApiFilePath
			properties.RemovedApiFile = paths.removedApiFilePath
			s.Scopes[apiScope] = properties
			s.Scopes[apiScope] = properties
		}
		}
	}
	}
@@ -1237,6 +1249,18 @@ func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberCo
			ctx.SnapshotBuilder().UnzipToSnapshot(properties.StubsSrcJar, snapshotRelativeDir)
			ctx.SnapshotBuilder().UnzipToSnapshot(properties.StubsSrcJar, snapshotRelativeDir)
			scopeSet.AddProperty("stub_srcs", []string{snapshotRelativeDir})
			scopeSet.AddProperty("stub_srcs", []string{snapshotRelativeDir})


			if properties.CurrentApiFile != nil {
				currentApiSnapshotPath := filepath.Join(scopeDir, ctx.Name()+".txt")
				ctx.SnapshotBuilder().CopyToSnapshot(properties.CurrentApiFile, currentApiSnapshotPath)
				scopeSet.AddProperty("current_api", currentApiSnapshotPath)
			}

			if properties.RemovedApiFile != nil {
				removedApiSnapshotPath := filepath.Join(scopeDir, ctx.Name()+"-removed.txt")
				ctx.SnapshotBuilder().CopyToSnapshot(properties.CurrentApiFile, removedApiSnapshotPath)
				scopeSet.AddProperty("removed_api", removedApiSnapshotPath)
			}

			if properties.SdkVersion != "" {
			if properties.SdkVersion != "" {
				scopeSet.AddProperty("sdk_version", properties.SdkVersion)
				scopeSet.AddProperty("sdk_version", properties.SdkVersion)
			}
			}
+18 −0
Original line number Original line Diff line number Diff line
@@ -998,16 +998,22 @@ java_sdk_library_import {
    public: {
    public: {
        jars: ["sdk_library/public/myjavalib-stubs.jar"],
        jars: ["sdk_library/public/myjavalib-stubs.jar"],
        stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
        stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
        current_api: "sdk_library/public/myjavalib.txt",
        removed_api: "sdk_library/public/myjavalib-removed.txt",
        sdk_version: "current",
        sdk_version: "current",
    },
    },
    system: {
    system: {
        jars: ["sdk_library/system/myjavalib-stubs.jar"],
        jars: ["sdk_library/system/myjavalib-stubs.jar"],
        stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
        stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
        current_api: "sdk_library/system/myjavalib.txt",
        removed_api: "sdk_library/system/myjavalib-removed.txt",
        sdk_version: "system_current",
        sdk_version: "system_current",
    },
    },
    test: {
    test: {
        jars: ["sdk_library/test/myjavalib-stubs.jar"],
        jars: ["sdk_library/test/myjavalib-stubs.jar"],
        stub_srcs: ["sdk_library/test/myjavalib_stub_sources"],
        stub_srcs: ["sdk_library/test/myjavalib_stub_sources"],
        current_api: "sdk_library/test/myjavalib.txt",
        removed_api: "sdk_library/test/myjavalib-removed.txt",
        sdk_version: "test_current",
        sdk_version: "test_current",
    },
    },
}
}
@@ -1019,16 +1025,22 @@ java_sdk_library_import {
    public: {
    public: {
        jars: ["sdk_library/public/myjavalib-stubs.jar"],
        jars: ["sdk_library/public/myjavalib-stubs.jar"],
        stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
        stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
        current_api: "sdk_library/public/myjavalib.txt",
        removed_api: "sdk_library/public/myjavalib-removed.txt",
        sdk_version: "current",
        sdk_version: "current",
    },
    },
    system: {
    system: {
        jars: ["sdk_library/system/myjavalib-stubs.jar"],
        jars: ["sdk_library/system/myjavalib-stubs.jar"],
        stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
        stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
        current_api: "sdk_library/system/myjavalib.txt",
        removed_api: "sdk_library/system/myjavalib-removed.txt",
        sdk_version: "system_current",
        sdk_version: "system_current",
    },
    },
    test: {
    test: {
        jars: ["sdk_library/test/myjavalib-stubs.jar"],
        jars: ["sdk_library/test/myjavalib-stubs.jar"],
        stub_srcs: ["sdk_library/test/myjavalib_stub_sources"],
        stub_srcs: ["sdk_library/test/myjavalib_stub_sources"],
        current_api: "sdk_library/test/myjavalib.txt",
        removed_api: "sdk_library/test/myjavalib-removed.txt",
        sdk_version: "test_current",
        sdk_version: "test_current",
    },
    },
}
}
@@ -1040,8 +1052,14 @@ sdk_snapshot {
`),
`),
		checkAllCopyRules(`
		checkAllCopyRules(`
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
.intermediates/myjavalib.stubs.source/android_common/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
.intermediates/myjavalib.stubs.source/android_common/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib-removed.txt
.intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
.intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
.intermediates/myjavalib.stubs.source.system/android_common/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
.intermediates/myjavalib.stubs.source.system/android_common/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib-removed.txt
.intermediates/myjavalib.stubs.test/android_common/javac/myjavalib.stubs.test.jar -> sdk_library/test/myjavalib-stubs.jar
.intermediates/myjavalib.stubs.test/android_common/javac/myjavalib.stubs.test.jar -> sdk_library/test/myjavalib-stubs.jar
.intermediates/myjavalib.stubs.source.test/android_common/myjavalib.stubs.source.test_api.txt -> sdk_library/test/myjavalib.txt
.intermediates/myjavalib.stubs.source.test/android_common/myjavalib.stubs.source.test_api.txt -> sdk_library/test/myjavalib-removed.txt
`),
`),
		checkMergeZips(
		checkMergeZips(
			".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
			".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",