-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/javadoc script #555
Merged
+150
−34
Merged
Fix/javadoc script #555
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,15 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
"""Generate TensorFlow Lite Java reference docs for TensorFlow.org.""" | ||
"""Generate TensorFlow Java reference docs for TensorFlow.org.""" | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import pathlib | ||
import shutil | ||
import tempfile | ||
from git import Repo | ||
|
||
from absl import app | ||
from absl import flags | ||
|
@@ -48,6 +49,18 @@ | |
TOOLS_DIR = pathlib.Path(__file__).resolve().parent | ||
REPO_ROOT = TOOLS_DIR.parent | ||
|
||
|
||
def checkout_ndarray(): | ||
repo_url = 'https://github.com/tensorflow/java-ndarray' | ||
local_repo_path = REPO_ROOT/'ndarray' | ||
if not pathlib.Path(local_repo_path).exists(): | ||
local_repo = Repo.clone_from(repo_url, local_repo_path) | ||
else: | ||
local_repo = Repo(local_repo_path) | ||
local_repo.remotes['origin'].fetch() | ||
local_repo.git.checkout('v1.0.0') | ||
|
||
|
||
def overlay(from_root, to_root): | ||
for from_path in pathlib.Path(from_root).rglob('*'): | ||
relpath = from_path.relative_to(from_root) | ||
|
@@ -58,24 +71,27 @@ def overlay(from_root, to_root): | |
else: | ||
to_path.mkdir(exist_ok=True) | ||
|
||
|
||
def main(unused_argv): | ||
checkout_ndarray() | ||
merged_source = pathlib.Path(tempfile.mkdtemp()) | ||
(merged_source / 'java/org').mkdir(parents=True) | ||
|
||
shutil.copytree(REPO_ROOT/'tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/', | ||
merged_source/'java/org/tensorflow') | ||
overlay(REPO_ROOT/'tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow', | ||
merged_source/'java/org/tensorflow') | ||
shutil.copytree(REPO_ROOT/'tensorflow-framework/src/main/java/org/tensorflow/framework', | ||
merged_source/'java/org/tensorflow/framework') | ||
shutil.copytree(REPO_ROOT/'ndarray/src/main/java/org/tensorflow/ndarray', | ||
merged_source/'java/org/tensorflow/ndarray') | ||
shutil.copytree(REPO_ROOT/'tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/', merged_source/'java/org/tensorflow') | ||
overlay(REPO_ROOT/'tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow', merged_source/'java/org/tensorflow') | ||
shutil.copytree(REPO_ROOT/'tensorflow-core/tensorflow-core-native/src/gen/java/org/tensorflow/proto', merged_source/'java/org/tensorflow/proto') | ||
shutil.copytree(REPO_ROOT/'tensorflow-core/tensorflow-core-native/src/main/java/org/tensorflow/exceptions', merged_source/'java/org/tensorflow/exceptions') | ||
shutil.copytree(REPO_ROOT/'tensorflow-core/tensorflow-core-native/src/gen/java/org/tensorflow/internal/c_api', merged_source/'java/org/tensorflow/internal/c_api') | ||
shutil.copytree(REPO_ROOT/'tensorflow-framework/src/main/java/org/tensorflow/framework', merged_source/'java/org/tensorflow/framework') | ||
shutil.copytree(REPO_ROOT/'ndarray/ndarray/src/main/java/org/tensorflow/ndarray', merged_source/'java/org/tensorflow/ndarray') | ||
|
||
gen_java.gen_java_docs( | ||
package='org.tensorflow', | ||
source_path=merged_source / 'java', | ||
output_dir=pathlib.Path(FLAGS.output_dir), | ||
site_path=pathlib.Path(FLAGS.site_path)) | ||
site_path=pathlib.Path(FLAGS.site_path), | ||
script_path=pathlib.Path(REPO_ROOT/'tools/run-javadoc-for-tf.sh'), # FIXME use default one?? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file isn't in the PR. |
||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be defined up top as
TF_NDARRAY_VERSION
so it's easier to see?